﻿@model ORM.Areas.Admin.ViewModels.ManageCategories.InsertModelCategoryViewModel
@{
    ViewBag.Title = "Edit Model";
    ViewBag.MenuGroup = "Categories";
    ViewBag.MenuName = "ManageModelCategories";
    ViewBag.PageHeader = "Edit a Model Category";
}
@*@Html.Partial("_ModelCategoryInputForm", Model)*@
@Html.ValidationSummary(true, ValidationMessages.Summary)
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>

<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="content-box">
    <div class="content-box-header">
        <h3>
            Model Category information</h3>
    </div>
    <div class="content-box-content">
      @using (Html.BeginForm("EditModelCategory", "ManageCategories", FormMethod.Post, new { enctype = "multipart/form-data", @id = "user-edit-form" }))
        {
          
                @Html.HiddenFor(m => m.Model.Id)
                <div class="input">
                    <p class="required">
                        @Html.LabelFor(m => m.Model.Name)
                        @Html.TextBoxFor(m => m.Model.Name, new {@class = "text-input small-input"})
                        @Html.ValidationMessageFor(m => m.Model.Name)
                    
                    </p>
                    <p >
                        @Html.LabelFor(m => m.Model.Description)
                        @Html.TextBoxFor(m => m.Model.Description, new {@class = "text-input small-input"})
                        @Html.ValidationMessageFor(m => m.Model.Name)
                    
                    </p>
                

                    <p>                    
                        @Html.LabelFor(m => m.Model.ManufacturerId)
                        @Html.DropDownListFor(m => m.Model.ManufacturerId, (IEnumerable<SelectListItem>) (ViewBag.Manufacturer), new {id = "ManufacturerId"})
                        @* @Html.DropDownList("Manufacturer", "----Chọn nhà sản xuất----")*@
                        @Html.ValidationMessageFor(model => model.Model.ManufacturerId)
                   
                    </p>                
                    <p>
                        @* <p>
                        @Html.LabelFor(m => m.Manufacturer.Id)
                        @Html.DropDownListFor(m => m.Manufacturer.Id, new SelectList(Model.Manufacturer, "Id", "Name"), new { @class = "medium-input" })
                    </p>*@
                   
                    </p>
                    <p>
                        @Html.LabelFor(m => m.Model.DeviceId)
                        @Html.DropDownListFor(m => m.Model.DeviceId, (IEnumerable<SelectListItem>) (ViewBag.Device), new {id = "DeviceId"})                  
                        @Html.ValidationMessageFor(model => model.Model.DeviceId)
                    </p>
                    <br />
                    <div class="editor-label">
                        @Html.LabelFor(m => m.Model.ImageUrl)
                    </div>
                
                    <div class="editor-field" style="padding-top: 3px">
                        <input id="edit-picture-upload" type="file" style="height: 25px"
                               name="file" />
                    </div>  
                
                     <br />  
                    <button class="t-button t-button-icontext save" type="submit">
                    <span class="t-icon t-update"></span>Save</button>
                   
                    <a class="t-button t-button-icontext cancel" href="@Url.Action("ManageModelCategories", "ManageCategories")">
                    <span class="t-icon t-cancel"></span>Cancel</a>
                </div>
            
            if (ViewBag.UploadImageError != null)
       {
           <script type="text/javascript">
               if (ViewBag.UploadImageError != null) {
                   alert(ViewBag.UploadImageError);
               }
           </script>
       }
        }
    </div>
</div>
